﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data.Common;
using Transcend.FileUploader.Entity;
using Transcend.FileUploader.Utility;

namespace Transcend.FileUploader.Dao
{
	class DocInstanceMapper : Transcend.DP3.Db.IReaderMapper<DocInstance>
	{

		public DocInstance Map(DbDataReader dr)
		{
			DocInstance inst = new DocInstance();
            inst.AppTypeId = Transcend.DP3.Db.Database.GetValue<decimal>(dr, "APP_ID", -1);
            inst.DocNo = Transcend.DP3.Db.Database.GetValue<string>(dr, "DOC_NO", string.Empty);
            inst.Id = Transcend.DP3.Db.Database.GetValue<decimal>(dr, "ID", -1);
            inst.LastOperater = Transcend.DP3.Db.Database.GetValue<string>(dr, "MODIFY_USER_ID", string.Empty);
            inst.LastOpTime = Transcend.DP3.Db.Database.GetValue<DateTime>(dr, "MODIFY_DATE");
            inst.Pk = Transcend.DP3.Db.Database.GetValue<string>(dr, "PK_VALUE", string.Empty);
            inst.DocId = Transcend.DP3.Db.Database.GetValue<string>(dr, "RECORD_KEY", string.Empty);
            inst.VolNo = Transcend.DP3.Db.Database.GetValue<string>(dr, "VOL_NO", string.Empty);
            inst.IsDeleted = Transcend.DP3.Db.Database.GetValue<int>(dr, "IS_DEL", 0);
          //  inst.DIVISION_ID = Transcend.DP3.Db.Database.GetValue<int>(dr, "DIVISION_ID");
            inst.Uri = Transcend.DP3.Db.Database.GetValue<string>(dr, "FOLDER");
			return inst;
		}
	}
}
